//
//  LinkEffect.hpp
//  client
//
//  Created by will on 17/07/2017.
//
//

#ifndef LinkEffect_hpp
#define LinkEffect_hpp

#include "cocos2d.h"

using namespace cocos2d;

class LineEffect;
class LinkEffect : public Node{
public:
    static LinkEffect* create();
public:
    LinkEffect();
    ~LinkEffect();

    //world point
    void setStartPos(const Vec2& start);
    void setEndPos(const Vec2&end);
    
    void setStartPos(float x,float y);
    void setEndPos(float x,float y);
    
    void setLineEffect(LineEffect* line);
    void setStartNode(Node* node);
    void setEndNode(Node* node);
    
protected:
    bool init();
    
    void _updateLinkPos();
    void _faceTo(Node* node,const Vec2& from,const Vec2& to);

protected:
    LineEffect* _lineNode;
    Node* _startNode;
    Node* _endNode;
    Vec2 _start;
    Vec2 _end;
};


#endif /* LinkEffect_hpp */
